<template>
    <view class="info">
        <view class="header">
            <view class="title">
                工单信息
            </view>
        </view>
        <view class="body">
            <view class="form">
                <view class="form-item">
                    <view class="label">
                        工单号：
                    </view>
                    <view class="text">
                        {{ data.workCode || '--' }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        工序：
                    </view>
                    <view class="text">
                        {{ data.productionProcessesNum || '--' }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        产品编号：
                    </view>
                    <view class="text">
                        {{ data.materialCode || '--' }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        产品名称：
                    </view>
                    <view class="text">
                        {{ data.materialName || '--' }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        模具编号：
                    </view>
                    <view class="text">
                        {{ data.moldCode  || '--' }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        模具名称：
                    </view>
                    <view class="text">
                        {{ data.moldName  || '--' }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        计划数量：
                    </view>
                    <view class="text">
                        {{ data.planProduceQuantity }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        生产数量：
                    </view>
                    <view class="text">
                        {{ data.produceQuantity  }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        不良总数：
                    </view>
                    <view class="text">
                        {{ data.defectsNumber }}
                    </view>
                </view>
				<view class="form-item">
                    <view class="label">
                        剩余不良数量：
                    </view>
                    <view class="text">
                        {{ data.defectiveQuantity  }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        产品单重：
                    </view>
                    <view class="text">
                        {{ data.weight  }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        重量单位：
                    </view>
                    <view class="text">
                        {{ data.weightUnit || '--'  }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        不良描述：
                    </view>
                    <view class="text">
                        {{ data.outReason || '--'  }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        报工人：
                    </view>
                    <view class="text">
                        {{ data.operator || '--'  }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        报工时间：
                    </view>
                    <view class="text">
                        {{ data.reportingTime || '--'  }}
                    </view>
                </view>
                <view class="form-item">
                    <view class="label">
                        备注：
                    </view>
                    <view class="text">
                        {{ data.remarks || '--'  }}
                    </view>
                </view>
            </view>
        </view>
        <view class="footer">
            <Button text @click="back" class="text_btn">
                查看其他工单
            </Button>
            <Button type="success" @click="goto('/pages/workbench/index')" class="back_btn">
                返回主菜单
            </Button>
        </view>
    </view>
</template>

<script>
    import Tag from "@/components/tag/index.vue";
    import Button from "@/components/button/index.vue";

    export default {
        props: {
            data: {
                type: Object,
                default: () => {}
            },
            backUrl: {
                type: String,
                default: ''
            }
        },
        components: {
            Tag,
            Button
        },
        data() {
            return {

            };
        },
        methods: {
            filterState(state = 3) {
                switch (state) {
                    case 0:
                        return '停机'
                    case 1:
                        return '运行'
                    case 2:
                        return '待机'
                    case 3:
                        return '待机'
                }
                return '待机';
            },
            goto(url) {
                uni.navigateTo({
                    url,
                    animationType: "pop-in",
                    animationDuration: 1000,
                })
            },
            back() {
													 uni.navigateBack(-1)
                // if (this.backUrl) {
                //     this.goto(this.backUrl);
                // } else {
                   
                // }
            }
        }
    }
</script>

<style lang="scss">
    .info {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100%;

        .header {
            flex: 0 auto;
            padding: 0 3rem;

            .title {
                display: flex;
                justify-content: flex-start;
                align-items: center;
                padding: 2rem 0;
                font-weight: bold;
                height: 8rem;
                border-bottom: 1px solid #ccc;
            }
        }

        .body {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 5rem 5rem 0;

            .form {
                flex: 1;

                .form-item {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    margin: 0 0 3rem;

                    .label {
                        color: #999;
                        flex: 1;
                    }

                    .text {
                        color: #333;
                        width: 26rem;
                        word-break: break-all;
                    }

                    &:last-child {
                        margin-bottom: 0;
                    }
                }
            }
        }

        .footer {
            flex: 0 auto;
            padding: 0 3rem 3rem;
        }

        .text_btn {
            margin-top: 3rem;
        }

        .back_btn {
            margin-top: 2rem;
        }
    }
</style>